% this program is used to test the shape_value function
% which using various type FE with different orders
% shape function test pass at Jul. 18th., 2012.

v1 = [1, 0];
v2 = [0, 1];
v3 = [0, 0];

plot_d = 10;

% make simple mesh with only one triangle
tris = make_mesh(plot_d);
[I,J,K] = indices(plot_d);
p = (I*v1+J*v2+K*v3)/plot_d;

% eval basis functions, second order comparements
[psiL, psi_xiL, psi_etaL] = shape_value(p(:,1), p(:,2), 2, 'Lagrange');
[psiB, psi_xiB, psi_etaB] = shape_value(p(:,1), p(:,2), 2, 'Bernstein');
[psiH, psi_xiH, psi_etaH] = shape_value(p(:,1), p(:,2), 2, 'Hierarchy');
% [psiD, psi_xiD, psi_etaD] = shape_value(p(:,1), p(:,2), 2, 'DG');

for i=1:6
    subplot(3,6,i); trisurf(tris, p(:,1), p(:,2), psiL(:,i));title(['Lagrange 2nd ' num2str(i) ' th']);
    subplot(3,6,6+i); trisurf(tris, p(:,1), p(:,2), psiB(:,i));title(['Bernstein 2nd ' num2str(i) ' th']);
    subplot(3,6,12+i); trisurf(tris, p(:,1), p(:,2), psiH(:,i));title(['Hierarchy 2nd ' num2str(i) ' th']);
%     subplot(2,2,4); trisurf(tris, p(:,1), p(:,2), psiD(:,i));title(['DF 2nd ' num2str(i)]);
%     pause;    
end